<?php 
include_once("../c/config.php");
require_once "jssdk.php";
$jssdk = new JSSDK($appId, $secret);
$signPackage = $jssdk->GetSignPackage();
$acToken=$jssdk->getAccessToken();
$url='https://api.weixin.qq.com/card/code/get?access_token='.$acToken;
$cardInfo=json_encode(array(
		'code'=>'752536201356'
));
function send_post($url, $post_data) {
	$options = array(
			'http' => array(
					'method' => 'POST',
					'header' => 'Content-type:application/json;charset=UTF-8',
					'content' => $post_data,
					'timeout' => 15 * 60 // 超时时间（单位:s）
			)
	);
	$context = stream_context_create($options);
	$result = file_get_contents($url, false, $context);

	return $result;
}

$data=send_post($url, $cardInfo);
var_dump($data);

sleep(2);

$url='https://api.weixin.qq.com/card/code/consume?access_token='.$acToken;
$cardInfo=json_encode(array(
		'code'=>'752536201356'
));
$data=send_post($url, $cardInfo);
var_dump($data);